<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="UTF-8"
	import="com.motlepluslong.model.*,com.motlepluslong.view.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Le mot le plus long</title>
<jsp:useBean id="game" class="com.motlepluslong.model.Game"
	scope="session"></jsp:useBean>
<jsp:useBean id="existWord" class="java.lang.String" scope="request"></jsp:useBean>
</head>
<body>
	<h1>Le JEU !!</h1>
	<span class="score">Score : <%=game.getScore()%></span>
	<span class="coupRemaining">Nombre de mot restant : <%
		out.println(5 - game.getPlayed());
	%></span>
	<%
		if ((5 - game.getPlayed()) == 0 && game.getLongestWord() != null)
			out.println("<span class='longuestWord'>Le mot le plus long possible est : "
					+ game.getLongestWord() + ".</span>");
		if(!existWord.equals(""))
			out.println("<span class='existWord'>Vous avez dejà soumis le mot : "+existWord+".</span>");

		GameView.displayLetters(game, out);
	%>
	<%
		if (game.getPlayed() < 5) {
	%>
	<form method='post' action='./actioncontroller.jsp'>
		<p>
			<input type='hidden' name='action' value='addWords' /> <label>Mot
				: </label> <input type='text' name='words' /> <input type='submit'
				value='Envoyer le mot' />
		</p>
	</form>
	<%
		}
		GameView.displayWords(game, out);
	%>
	<a href='./actioncontroller.jsp?action=reloadGame'>Nouveau Jeu</a>
</body>
</html>